home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / HENSA / MATHS / PLPLOT / PLPLOT.ZIP / sys / amiga / old / amiold.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-16  |  6.5 KB  |  235 lines

  1. #include "plplot.h"
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5.  
  6. #include "plamiga.h"
  7. #include <libraries/dosextens.h>
  8.  
  9. #define PLOKGAD    0
  10. #define PLCAGAD    1
  11. #define PLSTGAD    2
  12.  
  13. static UBYTE Gadget3SIBuff[80];
  14. static struct StringInfo Gadget3SInfo =
  15. {
  16.     Gadget3SIBuff,        /* buffer where text will be edited */
  17.     NULL,            /* optional undo buffer */
  18.     0,                /* character position in buffer */
  19.     80,                /* maximum number of characters to allow */
  20.     0,                /* first displayed character buffer position */
  21.     0, 0, 0, 0, 0,        /* Intuition initialized and maintained variables */
  22.     0,                /* Rastport of gadget */
  23.     0,                /* initial value for integer gadgets */
  24.     NULL            /* alternate keymap (fill in if you set the flag) */
  25. };
  26.  
  27. static struct Gadget Gadget3 =
  28. {
  29.     NULL,            /* next gadget */
  30.     11, 30,            /* origin XY of hit box relative to window TopLeft */
  31.     158, 9,            /* hit box width and height */
  32.     NULL,            /* gadget flags */
  33.     RELVERIFY + ENDGADGET + STRINGCENTER,    /* activation flags */
  34.     STRGADGET + REQGADGET,    /* gadget type flags */
  35.     NULL,            /* gadget border or image to be rendered */
  36.     NULL,            /* alternate imagery for selection */
  37.     NULL,            /* first IntuiText structure */
  38.     NULL,            /* gadget mutual-exclude long word */
  39.     (APTR) & Gadget3SInfo,    /* SpecialInfo structure */
  40.     PLSTGAD,            /* user-definable data */
  41.     NULL            /* pointer to user-definable data */
  42. };
  43.  
  44. static SHORT BorderVectors1[] =
  45. {
  46.     0, 0,
  47.     61, 0,
  48.     61, 16,
  49.     0, 16,
  50.     0, 0
  51. };
  52. static struct Border Border1 =
  53. {
  54.     -1, -1,            /* XY origin relative to container TopLeft */
  55.     1, 0, JAM1,            /* front pen, back pen and drawmode */
  56.     5,                /* number of XY vectors */
  57.     BorderVectors1,        /* pointer to XY vectors */
  58.     NULL            /* next border in list */
  59. };
  60.  
  61. static struct IntuiText IText1 =
  62. {
  63.     3, 0, JAM2,            /* front and back text pens, drawmode and fill byte */
  64.     7, 4,            /* XY origin relative to container TopLeft */
  65.     NULL,            /* font pointer or NULL for default */
  66.     "CANCEL",            /* pointer to text */
  67.     NULL            /* next IntuiText structure */
  68. };
  69.  
  70. static struct Gadget Gadget2 =
  71. {
  72.     &Gadget3,            /* next gadget */
  73.     110, 65,            /* origin XY of hit box relative to window TopLeft */
  74.     60, 15,            /* hit box width and height */
  75.     NULL,            /* gadget flags */
  76.     RELVERIFY + ENDGADGET,    /* activation flags */
  77.     BOOLGADGET + REQGADGET,    /* gadget type flags */
  78.     (APTR) & Border1,        /* gadget border or image to be rendered */
  79.     NULL,            /* alternate imagery for selection */
  80.     &IText1,            /* first IntuiText structure */
  81.     NULL,            /* gadget mutual-exclude long word */
  82.     NULL,            /* SpecialInfo structure */
  83.     PLCAGAD,            /* user-definable data */
  84.     NULL            /* pointer to user-definable data */
  85. };
  86.  
  87. static SHORT BorderVectors2[] =
  88. {
  89.     0, 0,
  90.     61, 0,
  91.     61, 16,
  92.     0, 16,
  93.     0, 0
  94. };
  95. static struct Border Border2 =
  96. {
  97.     -1, -1,            /* XY origin relative to container TopLeft */
  98.     1, 0, JAM1,            /* front pen, back pen and drawmode */
  99.     5,                /* number of XY vectors */
  100.     BorderVectors2,        /* pointer to XY vectors */
  101.     NULL            /* next border in list */
  102. };
  103.  
  104. static struct IntuiText IText2 =
  105. {
  106.     3, 0, JAM2,            /* front and back text pens, drawmode and fill byte */
  107.     24, 4,            /* XY origin relative to container TopLeft */
  108.     NULL,            /* font pointer or NULL for default */
  109.     "OK",            /* pointer to text */
  110.     NULL            /* next IntuiText structure */
  111. };
  112.  
  113. static struct Gadget Gadget1 =
  114. {
  115.     &Gadget2,            /* next gadget */
  116.     10, 65,            /* origin XY of hit box relative to window TopLeft */
  117.     60, 15,            /* hit box width and height */
  118.     NULL,            /* gadget flags */
  119.     RELVERIFY + ENDGADGET,    /* activation flags */
  120.     BOOLGADGET + REQGADGET,    /* gadget type flags */
  121.     (APTR) & Border2,        /* gadget border or image to be rendered */
  122.     NULL,            /* alternate imagery for selection */
  123.     &IText2,            /* first IntuiText structure */
  124.     NULL,            /* gadget mutual-exclude long word */
  125.     NULL,            /* SpecialInfo structure */
  126.     PLOKGAD,            /* user-definable data */
  127.     NULL            /* pointer to user-definable data */
  128. };
  129.  
  130. #define GadgetList1 Gadget1
  131.  
  132. static SHORT BorderVectors4[] =
  133. {
  134.     0, 0,
  135.     161, 0,
  136.     161, 12,
  137.     0, 12,
  138.     0, 0
  139. };
  140. static struct Border Border4 =
  141. {
  142.     9, 28,            /* XY origin relative to container TopLeft */
  143.     3, 0, JAM1,            /* front pen, back pen and drawmode */
  144.     5,                /* number of XY vectors */
  145.     BorderVectors4,        /* pointer to XY vectors */
  146.     NULL            /* next border in list */
  147. };
  148.  
  149. static SHORT BorderVectors3[] =
  150. {
  151.     0, 0,
  152.     179, 0,
  153.     179, 99,
  154.     0, 99,
  155.     0, 0
  156. };
  157. static struct Border Border3 =
  158. {
  159.     0, 0,            /* XY origin relative to container TopLeft */
  160.     3, 0, JAM1,            /* front pen, back pen and drawmode */
  161.     5,                /* number of XY vectors */
  162.     BorderVectors3,        /* pointer to XY vectors */
  163.     &Border4            /* next border in list */
  164. };
  165.  
  166. #define BorderList1 Border3
  167.  
  168. static struct IntuiText IText3 =
  169. {
  170.     3, 0, JAM2,            /* front and back text pens, drawmode and fill byte */
  171.     41, 17,            /* XY origin relative to container TopLeft */
  172.     NULL,            /* font pointer or NULL for default */
  173.     "IFF File Name",        /* pointer to text */
  174.     NULL            /* next IntuiText structure */
  175. };
  176.  
  177. #define IntuiTextList1 IText3
  178.  
  179. static struct Requester PLFileReq =
  180. {
  181.     NULL,            /* previous requester (filled in by Intuition) */
  182.     5, 15,            /* requester XY origin relative to TopLeft of window */
  183.     180, 100,            /* requester width and height */
  184.     0, 0,            /* relative to these mouse offsets if POINTREL is set */
  185.     &GadgetList1,        /* gadget list */
  186.     &BorderList1,        /* box's border */
  187.     &IntuiTextList1,        /* requester text */
  188.     NULL,            /* requester flags */
  189.     0,                /* back-plane fill pen */
  190.     NULL,            /* leave these alone */
  191.     NULL,            /* custom bitmap if PREDRAWN is set */
  192.     NULL            /* leave this alone */
  193. };
  194.  
  195. /* end of PowerWindows source generation */
  196.  
  197. char *
  198. plfilereq(void)
  199. {
  200.     ULONG oldFlags;
  201.     USHORT gadid;
  202.     char *file;
  203.     struct IntuiMessage *message;
  204.  
  205.     oldFlags = PLWindow->IDCMPFlags;
  206.     ModifyIDCMP(PLWindow, GADGETUP);
  207.     Request(&PLFileReq, PLWindow);
  208.     Wait(1 << PLWindow->UserPort->mp_SigBit);
  209.     message = (struct IntuiMessage *) GetMsg(PLWindow->UserPort);
  210.     gadid = ((struct Gadget *) message->IAddress)->GadgetID;
  211.     ReplyMsg((struct Message *) message);
  212.     switch (gadid) {
  213.     case PLOKGAD:
  214.     if (Gadget3SIBuff[0] == NULL)
  215.         file = NULL;
  216.     else
  217.         file = (char *) Gadget3SIBuff;
  218.     break;
  219.     case PLCAGAD:
  220.     file = NULL;
  221.     break;
  222.     case PLSTGAD:
  223.     if (Gadget3SIBuff[0] == NULL)
  224.         file = NULL;
  225.     else
  226.         file = (char *) Gadget3SIBuff;
  227.     break;
  228.     default:
  229.     break;
  230.     }
  231.     ModifyIDCMP(PLWindow, oldFlags);
  232.     return (file);
  233. }
  234.  
  235.